#define _CRT_SECURE_NO_WARNINGS 1#include <iostream>
#include<iostream>

using namespace std;

int GetMonth(int year, int month)
{
    int a[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
        a[month] = 29;
    return a[month];
}


int main() {
    int year, day;
    while (scanf("%d %d", &year, &day) != EOF)
    {
        int i = 1;
        while (day > 0)
        {
            int tmp = GetMonth(year, i);
            if (day > tmp)
            {
                day -= tmp;
                i++;
            }
            else
                break;
        }
        printf("%d-%02d-%02d\n", year, i, day);
    }
    return 0;
}
